package com.itshi.plic;

import com.itshi.pojo.Account;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

/**
 * @author げっしょく
 * @date 2021/8/20
 */
public class Test4 {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/song?useSSL=false", "root", "1234");
        String username = "fahwlafl";
        String password = "' or '1'='1";
        String sql = "select * from userd where username='"+username+"' and password='"+password+"'";
        Statement sta = con.createStatement();
        ResultSet result = sta.executeQuery(sql);
        while(result.next()){
            String string = result.getString(1);
            String string2 = result.getString(2);
            System.out.println(string);
            System.out.println(string2);
        }
        con.close();
        sta.close();
        result.close();
    }
}
